package com.r.pan.constant;

public class Constants {
    // session key
    public static final String SESSION_KEY__IMAGE_CODE_FOR_EMAIL = "image-code-for-email";
    public static final String SESSION_KEY__IMAGE_CODE_FOR_OTHERS = "image-code-for-others";
    public static final String SESSION_KEY__LOGIN_INFO = "login-info";

    // redis key
    public static final String REDIS_KEY__APP = "r-pan:";
    public static final String REDIS_KEY__SYSTEM_SETTING = REDIS_KEY__APP + "system-setting";
    public static final String REDIS_KEY__SPACE_INFO = REDIS_KEY__APP + "space-info:"; // 拼接userId成为键

    // length size duration spires
    public static final Integer LENGTH__CODE = 5;
    public static final Integer LENGTH__USER_ID = 5;
    public static final Long DURATION__CODE = 15L; // 邮箱验证码过期时间（分钟）
    public static final Long SPIRES__SPACE_INFO = 60 * 60 * 24L; // redis数据过期时间（秒，总共一天）

    // change unit
    public static final Long UNIT_CHANGE__GB_TO_BYTE = 1024L * 1024L;

    // regex
    public static final String REGEX__EMAIL = "^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\\.[a-zA-Z0-9_-]+)+$";
    public static final String REGEX__USERNAME = "^[\\u4e00-\\u9fa5a-zA-Z0-9_-]{4,12}$";
    public static final String REGEX__PASSWORD = "^(?![a-zA-Z]+$)(?!\\d+$)(?![^\\da-zA-Z\\s]+$).{8,}$";

    // exception message
    public static final String EXCEPTION_MESSAGE__SUCCESS = "请求成功";
    public static final String EXCEPTION_MESSAGE__INTERNAL_ERROR = "服务器内部错误";
    public static final String EXCEPTION_MESSAGE__NOT_FOUND = "请求地址不存在";
    public static final String EXCEPTION_MESSAGE__REQUEST_METHOD_ERROR = "请求方式错误";
    public static final String EXCEPTION_MESSAGE__PARAMETER_ERROR = "参数错误";
    public static final String EXCEPTION_MESSAGE__PARAMETER_ERROR__FORMAT = "%s 参数错误";

    // validation message
    public static final String INVALID__EMAIL = "邮箱校验错误";
    public static final String INVALID__IMAGE_CODE = "图片验证码校验错误";
    public static final String INVALID__EMAIL_CODE = "邮箱验证码校验错误";
    public static final String INVALID__TYPE = "类型校验错误";
    public static final String INVALID__USERNAME = "用户名校验错误";
    public static final String INVALID__PASSWORD = "密码校验错误";
}
